﻿using PlantsZombies.Common.CardTool;
using PlantsZombies.Common.Plant;
using System.Drawing;
using System.Windows.Forms;

namespace PlantsZombies.Common
{
    [PlantZombie(SpeciesType.Sunflower)]
    public unsafe class GameSunflower : PlantObject
    {
        public GameSunflower(ImageObject[] images)
            : base(images,SpeciesType.Sunflower, 10, 0, new Size(64, 64))
        {
        }

        public override void MouseDown(object sender, MouseEventArgs e)
        {
            var bullets = Bullet.BulletObjects;
            for (int k = bullets.Count - 1; k >= 0; k--)
            {
                var bullet = bullets[k];
                var rect = new Rectangle(bullet.X, bullet.Y, Bullet.BulletSize.Width, Bullet.BulletSize.Height);
                if (rect.Contains(e.Location))
                {
                    bullets.RemoveAt(k);
                    if (MouseDownCallback != null)
                        MouseDownCallback();
                    return;
                }
            }
        }
    }
}
